package com.zxs.admin.service.impl;

import client.UserCient;
import com.zxs.admin.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import parm.CartListParm;
import parm.PageParam;
import pojo.User;
import utils.R;

/**
 * @author zxs
 * *9 16:12
 */
@Service
@Slf4j
public class UserServiceImpl implements UserService {
    @Autowired
    private UserCient userCient;
    /**
     * 通过用户服务调用 查询用户列表
     * @param pageParam
     * @return
     */
    @Override
    public R listPage(PageParam pageParam) {
        R list = userCient.list(pageParam);
        log.info("userCient.list:",list);
        return list;
    }

    /**
     * 删除用户
     * @param cartListParm
     * @return
     */
    @Override
    public R removeUser(CartListParm cartListParm) {
        R remove = userCient.remove(cartListParm);
        return R.ok("删除成功！");
    }

    /**
     * 修改用户信息
     * @param user
     * @return
     */
    @Override
    public R update(User user) {
        R result = userCient.update(user);
        return result;
    }

    /**
     * 添加用户信息
     * @param user
     * @return
     */
    @Override
    public R save(User user) {
        R save = userCient.save(user);
        return save;
    }
}
